package com.bdqn.service.imp;

import com.bdqn.bean.user.User;
import com.bdqn.dao.IUserDao;
import com.bdqn.dao.imp.UserDaoImp;
import com.bdqn.service.IUserService;
import com.bdqn.utli.Encrypt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 忍
 * @title: UserServiceImp
 * @projectName Teaching
 * @description: TODO
 * @date 2019/4/279:17
 */
@Service
public class UserServiceImp implements IUserService {
    @Qualifier("IUserDao")
    @Autowired
    private IUserDao userDao;

    /**
     * @param phone
     * @return com.bdqn.bean.user.User
     * @throws
     * @description: 根据手机号获取用户
     * @author Mr.Zhou
     * @date 2019/4/27 0:25
     */
    @Override
    public User selectUserByPhone(String phone) {
        return userDao.selectUserByPhone(phone);
    }

    /**
     * @param user
     * @return void
     * @throws
     * @description:添加用户
     * @author Mr.Zhou
     * @date 2019/5/10 14:09
     */
    @Override
    public void addUser(User user) {
        userDao.addUser(user);
    }

    /**
     * @param phone
     * @param pwd
     * @return com.bdqn.bean.user.User
     * @throws
     * @description: 根据手机号, 密码获取用户
     * @author Mr.Zhou
     * @date 2019/4/27 0:25
     */
    @Override
    public User selectUserByPwd(String phone, String pwd) {
        pwd = Encrypt.string2MD5(pwd);
        return userDao.selectUserByPwd(phone,pwd);
    }
}
